Fix #68938.
authorFederico Mena Quintero <federico@ximian.com>
Tue, 3 Feb 2004 19:46:43 +0000 (19:46 +0000)
committerFederico Mena Quintero <federico@src.gnome.org>
Tue, 3 Feb 2004 19:46:43 +0000 (19:46 +0000)
2004-02-03  Federico Mena Quintero  <federico@ximian.com>

Fix #68938.

* gtk/gtkdialog.c (GtkDialogPrivate): New private structure for
GtkDialog; right now it only contains an ignore_separator field.
(gtk_dialog_class_init): Register the private structure.
(gtk_dialog_init): Initialize the priv->ignore_separator field.
(_gtk_dialog_set_ignore_separator): New private function.
(gtk_dialog_set_has_separator): Ignore the setting if appropriate.

* gtk/gtkmessagedialog.c (gtk_message_dialog_class_init): Add a
use_separator style property.
(gtk_message_dialog_style_set): Change the dialog's separator
based on the style property.
(gtk_message_dialog_init): Set the dialog box to ignore the
separator setting.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkdialog.c
gtk/gtkdialog.h
gtk/gtkmessagedialog.c

index 14040177550102d0e59099ddb992ddeb4187fd7f..3dd9c8e8773b9f623f1071459351dbb73ee99f7c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2004-02-03  Federico Mena Quintero  <federico@ximian.com>
+
+       Fix #68938.
+
+       * gtk/gtkdialog.c (GtkDialogPrivate): New private structure for
+       GtkDialog; right now it only contains an ignore_separator field.
+       (gtk_dialog_class_init): Register the private structure.
+       (gtk_dialog_init): Initialize the priv->ignore_separator field.
+       (_gtk_dialog_set_ignore_separator): New private function.
+       (gtk_dialog_set_has_separator): Ignore the setting if appropriate.
+
+       * gtk/gtkmessagedialog.c (gtk_message_dialog_class_init): Add a
+       use_separator style property.
+       (gtk_message_dialog_style_set): Change the dialog's separator
+       based on the style property.
+       (gtk_message_dialog_init): Set the dialog box to ignore the
+       separator setting.
+
 Tue Feb  3 02:35:09 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/Makefile.am: Build filesystemwin32.c if OS_WIN32 and
index 14040177550102d0e59099ddb992ddeb4187fd7f..3dd9c8e8773b9f623f1071459351dbb73ee99f7c 100644 (file)
@@ -1,3 +1,21 @@
+2004-02-03  Federico Mena Quintero  <federico@ximian.com>
+
+       Fix #68938.
+
+       * gtk/gtkdialog.c (GtkDialogPrivate): New private structure for
+       GtkDialog; right now it only contains an ignore_separator field.
+       (gtk_dialog_class_init): Register the private structure.
+       (gtk_dialog_init): Initialize the priv->ignore_separator field.
+       (_gtk_dialog_set_ignore_separator): New private function.
+       (gtk_dialog_set_has_separator): Ignore the setting if appropriate.
+
+       * gtk/gtkmessagedialog.c (gtk_message_dialog_class_init): Add a
+       use_separator style property.
+       (gtk_message_dialog_style_set): Change the dialog's separator
+       based on the style property.
+       (gtk_message_dialog_init): Set the dialog box to ignore the
+       separator setting.
+
 Tue Feb  3 02:35:09 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/Makefile.am: Build filesystemwin32.c if OS_WIN32 and
index 14040177550102d0e59099ddb992ddeb4187fd7f..3dd9c8e8773b9f623f1071459351dbb73ee99f7c 100644 (file)
@@ -1,3 +1,21 @@
+2004-02-03  Federico Mena Quintero  <federico@ximian.com>
+
+       Fix #68938.
+
+       * gtk/gtkdialog.c (GtkDialogPrivate): New private structure for
+       GtkDialog; right now it only contains an ignore_separator field.
+       (gtk_dialog_class_init): Register the private structure.
+       (gtk_dialog_init): Initialize the priv->ignore_separator field.
+       (_gtk_dialog_set_ignore_separator): New private function.
+       (gtk_dialog_set_has_separator): Ignore the setting if appropriate.
+
+       * gtk/gtkmessagedialog.c (gtk_message_dialog_class_init): Add a
+       use_separator style property.
+       (gtk_message_dialog_style_set): Change the dialog's separator
+       based on the style property.
+       (gtk_message_dialog_init): Set the dialog box to ignore the
+       separator setting.
+
 Tue Feb  3 02:35:09 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/Makefile.am: Build filesystemwin32.c if OS_WIN32 and
index 14040177550102d0e59099ddb992ddeb4187fd7f..3dd9c8e8773b9f623f1071459351dbb73ee99f7c 100644 (file)
@@ -1,3 +1,21 @@
+2004-02-03  Federico Mena Quintero  <federico@ximian.com>
+
+       Fix #68938.
+
+       * gtk/gtkdialog.c (GtkDialogPrivate): New private structure for
+       GtkDialog; right now it only contains an ignore_separator field.
+       (gtk_dialog_class_init): Register the private structure.
+       (gtk_dialog_init): Initialize the priv->ignore_separator field.
+       (_gtk_dialog_set_ignore_separator): New private function.
+       (gtk_dialog_set_has_separator): Ignore the setting if appropriate.
+
+       * gtk/gtkmessagedialog.c (gtk_message_dialog_class_init): Add a
+       use_separator style property.
+       (gtk_message_dialog_style_set): Change the dialog's separator
+       based on the style property.
+       (gtk_message_dialog_init): Set the dialog box to ignore the
+       separator setting.
+
 Tue Feb  3 02:35:09 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/Makefile.am: Build filesystemwin32.c if OS_WIN32 and
index 14040177550102d0e59099ddb992ddeb4187fd7f..3dd9c8e8773b9f623f1071459351dbb73ee99f7c 100644 (file)
@@ -1,3 +1,21 @@
+2004-02-03  Federico Mena Quintero  <federico@ximian.com>
+
+       Fix #68938.
+
+       * gtk/gtkdialog.c (GtkDialogPrivate): New private structure for
+       GtkDialog; right now it only contains an ignore_separator field.
+       (gtk_dialog_class_init): Register the private structure.
+       (gtk_dialog_init): Initialize the priv->ignore_separator field.
+       (_gtk_dialog_set_ignore_separator): New private function.
+       (gtk_dialog_set_has_separator): Ignore the setting if appropriate.
+
+       * gtk/gtkmessagedialog.c (gtk_message_dialog_class_init): Add a
+       use_separator style property.
+       (gtk_message_dialog_style_set): Change the dialog's separator
+       based on the style property.
+       (gtk_message_dialog_init): Set the dialog box to ignore the
+       separator setting.
+
 Tue Feb  3 02:35:09 2004  Matthias Clasen  <maclas@gmx.de>
 
        * gtk/Makefile.am: Build filesystemwin32.c if OS_WIN32 and
index 4785cf3616f80eba710526657769609f88a25837..5b05b9d80a4915603399304f80cf7564af758ed6 100644 (file)
 #include "gtkintl.h"
 #include "gtkbindings.h"
 
+#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_DIALOG, GtkDialogPrivate))
+
+typedef struct {
+  guint ignore_separator : 1;
+} GtkDialogPrivate;
+
 typedef struct _ResponseData ResponseData;
 
 struct _ResponseData
@@ -130,6 +136,8 @@ gtk_dialog_class_init (GtkDialogClass *class)
 
   class->close = gtk_dialog_close;
   
+  g_type_class_add_private (gobject_class, sizeof (GtkDialogPrivate));
+
   g_object_class_install_property (gobject_class,
                                    PROP_HAS_SEPARATOR,
                                    g_param_spec_boolean ("has_separator",
@@ -219,6 +227,11 @@ update_spacings (GtkDialog *dialog)
 static void
 gtk_dialog_init (GtkDialog *dialog)
 {
+  GtkDialogPrivate *priv;
+
+  priv = GET_PRIVATE (dialog);
+  priv->ignore_separator = FALSE;
+
   /* To avoid breaking old code that prevents destroy on delete event
    * by connecting a handler, we have to have the FIRST signal
    * connection on the dialog.
@@ -766,10 +779,20 @@ void
 gtk_dialog_set_has_separator (GtkDialog *dialog,
                               gboolean   setting)
 {
+  GtkDialogPrivate *priv;
+
   g_return_if_fail (GTK_IS_DIALOG (dialog));
 
+  priv = GET_PRIVATE (dialog);
+
   /* this might fail if we get called before _init() somehow */
   g_assert (dialog->vbox != NULL);
+
+  if (priv->ignore_separator)
+    {
+      g_warning ("Ignoring the separator setting");
+      return;
+    }
   
   if (setting && dialog->separator == NULL)
     {
@@ -1001,3 +1024,13 @@ gtk_dialog_run (GtkDialog *dialog)
 
   return ri.response_id;
 }
+
+void
+_gtk_dialog_set_ignore_separator (GtkDialog *dialog,
+                                 gboolean   ignore_separator)
+{
+  GtkDialogPrivate *priv;
+
+  priv = GET_PRIVATE (dialog);
+  priv->ignore_separator = ignore_separator;
+}
index 953857c465b09b570ff498fc7b774c6d7e19e86c..60c860fa47f1e94dec482e6edd0f61666ad92dcf 100644 (file)
@@ -159,6 +159,11 @@ void gtk_dialog_response           (GtkDialog *dialog,
 /* Returns response_id */
 gint gtk_dialog_run                (GtkDialog *dialog);
 
+
+/* For private use only */
+void _gtk_dialog_set_ignore_separator (GtkDialog *dialog,
+                                      gboolean   ignore_separator);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 4c74ffeb990cf1164a4d1b87d27678c726cb733d..71c53d683336c7d2942813ca821e9769e81d0191 100644 (file)
@@ -109,6 +109,12 @@ gtk_message_dialog_class_init (GtkMessageDialogClass *class)
                                                              G_MAXINT,
                                                              8,
                                                              G_PARAM_READABLE));
+  gtk_widget_class_install_style_property (widget_class,
+                                          g_param_spec_boolean ("use_separator",
+                                                                P_("Use separator"),
+                                                                P_("Whether to put a separator between the message dialog's text and the buttons"),
+                                                                FALSE,
+                                                                G_PARAM_READABLE));
   g_object_class_install_property (gobject_class,
                                    PROP_MESSAGE_TYPE,
                                    g_param_spec_enum ("message_type",
@@ -153,6 +159,8 @@ gtk_message_dialog_init (GtkMessageDialog *dialog)
                       FALSE, FALSE, 0);
 
   gtk_widget_show_all (hbox);
+
+  _gtk_dialog_set_ignore_separator (GTK_DIALOG (dialog), TRUE);
 }
 
 static GtkMessageType
@@ -499,6 +507,7 @@ gtk_message_dialog_style_set (GtkWidget *widget,
 {
   GtkWidget *parent;
   gint border_width = 0;
+  gboolean use_separator;
 
   parent = GTK_WIDGET (GTK_MESSAGE_DIALOG (widget)->image->parent);
 
@@ -511,6 +520,13 @@ gtk_message_dialog_style_set (GtkWidget *widget,
                                       border_width);
     }
 
+  gtk_widget_style_get (widget,
+                       "use_separator", &use_separator,
+                       NULL);
+  _gtk_dialog_set_ignore_separator (GTK_DIALOG (widget), FALSE);
+  gtk_dialog_set_has_separator (GTK_DIALOG (widget), use_separator);
+  _gtk_dialog_set_ignore_separator (GTK_DIALOG (widget), TRUE);
+
   if (GTK_WIDGET_CLASS (parent_class)->style_set)
     (GTK_WIDGET_CLASS (parent_class)->style_set) (widget, prev_style);
 }